﻿using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Text;
using System.Xml.Serialization;


namespace LinkedService.Mobile.ServiceEntities
{
  /// <summary>
  /// Represents a Question.
  /// </summary>
  [XmlRoot(Namespace = "", ElementName = "question", IsNullable = false)]
  [XmlType("question")]
  public class Question
  {
    #region Constructors
    /// <summary>
    /// Initializes a new instance of the <see cref="Question"/> class.
    /// </summary>
    public Question()
    {
    }
    #endregion

    #region Properties
    /// <summary>
    /// Gets or sets the identifier of the question.
    /// </summary>
    [XmlElement("id")]
    public string id
    {
      get;
      set;
    }

    /// <summary>
    /// Gets or sets the title of the question
    /// </summary>
    [XmlElement("title")]
    public string Title
    {
      get;
      set;
    }

    /// <summary>
    /// Gets or sets the author of the quesiton
    /// </summary>
    [XmlElement("author")]
    public Person Author
    {
      get;
      set;
    }

    /// <summary>
    /// Gets or sets a collection of categories of the question
    /// </summary>
    [XmlArray("question-categories")]
    [XmlArrayItem("question-category")]
    public Collection<Category> Categories
    {
      get;
      set;
    }

    /// <summary>
    /// Gets or sets the url of the question
    /// </summary>
    [XmlElement("web-url")]
    public string WebUrl
    {
      get;
      set;
    }

    /// <summary>
    /// Gets or sets a collection of categories of the question
    /// </summary>
    [XmlArray("answers")]
    [XmlArrayItem("answer")]
    public Collection<Answer> Answers
    {
      get;
      set;
    }

    #endregion

  }
}
